package com.example.demo.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.mapper.WiringInfoMapper;
import com.example.demo.pojo.WiringInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WiringInfoService {

    @Autowired
    private WiringInfoMapper wiringInfoMapper;

    // 批量插入
    public void saveWiringInfo(List<WiringInfo> wiringInfoList) {
        wiringInfoMapper.batchInsert(wiringInfoList);
    }

    //根据所属变电站查找
    public IPage<WiringInfo> findBySubstation(String substation,Page<WiringInfo> page) {
        return wiringInfoMapper.findBySubstation(substation,page);
    }

    //根据维护班组查找
    public IPage<WiringInfo> findByMaintainTeam(String maintainTeam,Page<WiringInfo> page) {
        return wiringInfoMapper.findByMaintainTeam(maintainTeam,page);
    }

    //根据所属配变台区查找
    public IPage<WiringInfo> findByCourt(String court,Page<WiringInfo> page) {
        return wiringInfoMapper.findByCourt(court,page);
    }

    //根据是否光伏用户查找
    public IPage<WiringInfo> findByIsPhotovoltaicUser(String isPhotovoltaicUser,Page<WiringInfo> page) {
        return wiringInfoMapper.findByIsPhotovoltaicUser(isPhotovoltaicUser,page);
    }
    // 查询所有记录（示例）
    public IPage<WiringInfo> getAllWiringInfo(Page<WiringInfo> page) {
        return wiringInfoMapper.getAllWiringInfo(page);
    }
}
